package com.stone.inventory.sharding.config.properties;

import lombok.Data;

/**
 * 全局分布式id配置
 *
 * @author Mr_wenpan@163.com 2021/07/26
 */
@Data
public class GlobalIdProperties {

    private static final long CUSTOM_MUST_CONFIG_BITS = 22L;
    private static final long DEFAULT_NODE_BITS = 7L;
    private static final long DEFAULT_TABLE_BITS = 4L;
    private static final long DEFAULT_SEQUENCE_BITS = 11L;

    /**
     * 当前运行的实例id
     */
    private Long instanceId;

    /**
     * 节点占用位数
     */
    private Long nodeBits;

    /**
     * 分表占用位数
     */
    private Long tableBits;

    /**
     * 序列位数
     */
    private Long sequenceBits;

    public GlobalIdProperties() {
        nodeBits = DEFAULT_NODE_BITS;
        tableBits = DEFAULT_TABLE_BITS;
        sequenceBits = DEFAULT_SEQUENCE_BITS;
    }
}
